Release 10.1A: OpenEdge Development:
Programming Interfaces


Validation

Progress SAX always checks that the XML document is well formed. In addition, Progress SAX can validate the XML document against a DTD or XML schema or both.

Validation of an XML document read into a SAX-reader can be accomplished by providing a DTD, one or more XML schemas, or both. Table 20–5 provides a summary of how to perform the validation tasks required to support your desired validation scheme.

Table 20–5: Validation schemes
Validation task
Required action
Disable DTD validation
Set the VALIDATION-ENABLED attribute of the SAX-reader object to FALSE. All DTDs will be ignored.
Enable DTD validation
Set the VALIDATION-ENABLED attribute of the SAX-reader object to TRUE. (If the parser does not find a DTD, the parse fails.)
If the DTD is not included in the parsed XML document, provide the DTD location by setting the SCHEMA-PATH attribute of the SAX-reader object. If this attribute is set, DTDs found or referenced from the XML source are ignored in favor of the specified DTD.
Disable XML schema validation
Set the SCHEMA-LOCATION attribute to the empty string (““). This action does not disable XML Schema files specified in the XML document.
Enable XML Schema validation
Set the VALIDATION-ENABLED attribute of the SAX-reader object to TRUE. (If the parser does not find a DTD or XML Schema file, the parse fails.)
Specify the location of one or more XML schemas with the SCHEMA-PATH attribute of the SAX-reader object.
Enable both DTD and XML schema validation
Set the VALIDATION-ENABLED attribute to true and provide valid SCHEMA-PATH and SCHEMA-LOCATION values.

A DTD might be completely specified in the XML source. Alternatively, part of all of the DTD might reside in one or more external files named in the XML source. In the latter case, to override the locations given in the XML source, use one or both of the following techniques:

For more information, see the reference entries for the VALIDATION-ENABLED and SCHEMA-PATH attributes in the OpenEdge Development: Progress 4GL Reference .

Similarly, to use XML schema for validation, set the following attributes or use the method to declare your namespace/location pairs for the XML Schema files:

For more information, see these reference entries in the OpenEdge Development: Progress 4GL Reference .

Note: The parser will validate against both a DTD and XML schema if both types of validation are properly specified.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095